Ext.define('AmpleHarvest.DATA.Store.statistics.Process.ProcessingSummaryStore', {
    extend : 'Ext.data.Store',
    model : 'AmpleHarvest.DATA.Model.statistics.Process.ProcessingSummaryModel',
    remoteSort : 'true',
    // Set pageSize for store to change from default limit of 25
    pageSize : 35,
    
    requires				:
	[
		'AmpleHarvest.util.UrlBuilder'
	],

    constructor : function (config) {
        this.proxy = {
            type : 'ajax',
            url : AmpleHarvest.util.UrlBuilder.getProcessingSummaryUrl(),
            timeout : '300000',
            method : 'GET',
            startParam : 'offset',
            reader : {
                type : 'json',
                root : 'collection',
                totalProperty : 'totalCount'
            },
            simpleSortMode : true,
            afterRequest : function (request, success) {
                if (success) {
                    this.lastRequest = request.params;
                }
            },
            lastRequest : {},
            extraParams : {
                month : '0',
                view : 'TOTDAY'
            }
        };

        this.callParent(arguments);
    },

    sorters : {
        property : 'date',
        direction : 'DESC'
    },

    getLastRequest : function () {
        return this.proxy.lastRequest;
    },

    getLastRequestNoLimit : function () {
        var noLimitParams = Ext.clone(this.proxy.lastRequest);
        Ext.destroyMembers(noLimitParams, 'start', 'limit');

        return noLimitParams;
    }

});